package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
	"time"
)

func main() {
	myApp := app.New()
	window := myApp.NewWindow("fyne")
	label := widget.NewLabel("hello")
	window.SetContent(label)

	go showAnother(myApp)
	window.ShowAndRun()
}

// 弹出新窗口
func showAnother(a fyne.App) {
	time.Sleep(time.Second * 10)

	win := a.NewWindow("show later")
	label := widget.NewLabel("5 second later")
	win.SetContent(label)
	win.Resize(fyne.NewSize(720, 240))
	win.Show()

	time.Sleep(time.Second * 2)
	win.Close()
}
